home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / a56 / src / toomf.c < prev    next >
C/C++ Source or Header  |  1995-04-27  |  2KB  |  60 lines

  1. /*******************************************************
  2.  *
  3.  *  a56 - a DSP56001 assembler
  4.  *
  5.  *  Written by Quinn C. Jensen
  6.  *  July 1990
  7.  *
  8.  *******************************************************\
  9.  
  10. /*
  11.  * Copyright (C) 1990-1994 Quinn C. Jensen
  12.  *
  13.  * Permission to use, copy, modify, distribute, and sell this software
  14.  * and its documentation for any purpose is hereby granted without fee,
  15.  * provided that the above copyright notice appear in all copies and
  16.  * that both that copyright notice and this permission notice appear
  17.  * in supporting documentation.  The author makes no representations
  18.  * about the suitability of this software for any purpose.  It is
  19.  * provided "as is" without express or implied warranty.
  20.  *
  21.  */
  22. static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen";
  23.  
  24. /*
  25.  *  This small program converts the a56.out file from the assembler
  26.  *  into a file suitable for loading into 56001 memory via the
  27.  *  SLOADER.ASM serial loader program provided on the Motorola
  28.  *  Dr. Bubb BBS.
  29.  *
  30.  */
  31.  
  32. #define MAX 256
  33.  
  34. main(argc,argv)
  35. int argc;
  36. char *argv[];
  37. {
  38.     char buf[MAX];
  39.     int curaddr = 0;
  40.     int line = 0;
  41.     int curseg = '\0';
  42.     int startaddr = -1;
  43.  
  44.     while(gets(buf)) {
  45.     char seg;
  46.     int addr, data;
  47.     line++;
  48.     if(sscanf(buf, "%c%x%x", &seg, &addr, &data) == 3) {
  49.         if(seg != curseg || curaddr != addr) {
  50.         printf("\n_DATA %c %04X\n", curseg = seg, curaddr = addr);
  51.         }   
  52.         if(startaddr == -1 && seg == 'P')
  53.         startaddr = addr;
  54.         printf("%06X ", data & 0xFFFFFF);
  55.         curaddr++;
  56.     }
  57.     }
  58.     printf("\n_END %04X\n", startaddr);
  59. }
  60.